<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1{
            width: 100px;
            height: 100px;
            background-color: red;
        }
        .box2{
            width: 100px;
            height: 100px;
            background-color: green;
        }
        .box3{
            width: 100px;
            height: 100px;
            background-color: blue;
        }
        .box4{
            width: 100px;
            height: 100px;
            background-color: yellow;
        }
        .box5{
            width: 100px;
            height: 100px;
            background-color: grey;
        }
    </style>
</head>
<body>
    <button id="btn1">单击</button>
    <button id="btn2">双击</button>
    <button id="btn3">按下鼠标</button>
    <button id="btn4">释放鼠标</button>
    <div id="btn5" class="box1"></div>
    <div id="btn6" class="box2"></div>
    <div id="btn7" class="box3"></div>
    <div id="btn8" class="box4"></div>
    <div id="btn9" class="box5"></div>

    <script>
        var btn1 = document.getElementById("btn1");
        var btn2 = document.getElementById("btn2");
        var btn3 = document.getElementById("btn3");
        var btn4 = document.getElementById("btn4");
        var btn5 = document.getElementById("btn5");
        var btn6 = document.getElementById("btn6");
        var btn7 = document.getElementById("btn7");
        var btn8 = document.getElementById("btn8");
        var btn9 = document.getElementById("btn9");

        btn1.onclick = function(){
            console.log("单击");
        }
        btn2.ondblclick = function(){
            console.log("双击");
        }
        btn3.onmousedown = function(){
            console.log("摁下鼠标");
        }
        btn4.onmouseup = function(){
            console.log("释放鼠标");
        }
        btn5.onmousemove = function(){
            console.log("鼠标移动");
        }
        btn6.onmouseenter = function(){
            console.log("鼠标进入");
        }
        btn7.onmouseleave = function(){
            console.log("鼠标移出");
        }
        //上面两个和下面两个的区别
        //上面两个子节点不会触发，下面两个子节点也会触发
        btn8.onmouseover = function(){
            console.log("鼠标进入");
        }
        btn9.onmouseout = function(){
            console.log("鼠标移出");
        }




    </script>
</body>
</html>